<script>
$(document).ready(function(){
	{params}
	
	
	
	var c = {
		cnum:'',
		init:function(){
			this.cnum 	 = params.cnum;
			this.laiyuan = params.laiyuan;
			if(this.laiyuan=='im'){
				$('#gotoim{rand}').hide();
			}
			var str = js.getoption('userinfo'),arr,type;
			if(str){
				arr = js.decode(str)
				type='<font color="#888888">普通用户</font>';
				adminname = arr.name;
				adminface = arr.face;
				if(arr.type=='1')type = '<font color="green">管理员</font>';
				if(arr.type=='2')type = '<font color="red">超级管理员</font>';
				$('#jibie{rand}').html(type);
				$('#mobile{rand}').html(js.check.mobilexing(arr.mobile));
			}
			if(adminname)$('#name{rand}').html(adminname);
			if(adminface)get('myface_geren').src=adminface;
			if(!this.cnum)return;
			$('#dwdiv{rand}').show();
			str = js.getoption('useainfo'+this.cnum+'');
			if(str){
				arr = js.decode(str);
				$('#dwname{rand}').html(arr.name);
				$('#deptname{rand}').html(arr.deptname);
				$('#ranking{rand}').html(arr.ranking);
				$('#companyname{rand}').html(arr.companyname);
				$('#shouji{rand}').html(js.check.mobilexing(arr.mobile));
				
				type='<font color="#888888">普通用户</font>';
				if(arr.type=='1')type = '<font color="green">管理员</font>';
				if(arr.type=='2')type = '<font color="red">创建者</font>';
				$('#unitjibie{rand}').html(type);
				this.info  = arr;
			}
		},
		
		loginexit:function(){
			js.modal.confirm('确定要退出系统嘛？', function(jg){
				if(jg=='yes')c.loginexitok();
			});
		},
		loginexitoks:function(){
			js.show.success('已退出');
			js.setoption('token');
			js.setoption('myinfo');
			js.setoption('defnowurl');
			js.reload();
		},
		loginexitok:function(){
			js.ajax.get({
				url:'api/geren/exit',
				loading:'退出中...',
				onsuccess:function(){
					c.loginexitoks();
				},
				onerror:function(){
					c.loginexitoks();
				}
			});
		},
		editpassv:function(o1){
			if(this.laiyuan=='im'){
				reim.addtabs('editpass', 'admin/editpass');
			}else{
				addtabs({name:'修改密码','url':'admin/editpass',num:'editpass'});
			}
		},
		editface:function(){
			
			importjs('rockfile','changeface',{
				fields:'testabc',name:'修改头像',
				oncallback:function(str){
					get('myface_geren').src = str;
					js.setoption('adminface', str);
					js.ajax.get({
						url:'api/geren/editface',
						data:{
							face:jm.base64encode(str)
						}
					});
				}
			});
		
		},
		edittheme:function(o1){
			addtabs({name:'主题颜色','url':'admin/theme',num:'theme'});
		},
		fontsize:function(o1){
			addtabs({name:'字体大小','url':'admin/fontsize',num:'fontsize'});
		},
		editnickname:function(){
			
		},
		editmobile:function(){
			js.modal.main({
				title:'修改手机号',
				width:300,height:200,
				bbar:'none',
				action:'edphoneshow',
				html:'<div id="editmobileshowdiv"></div>'
			});
			xcy.addcont('admin/editmobile','editmobileshowdiv','', function(){
				js.modal.resize('edphoneshow');
			});
		},
		editcompany:function(){
			js.modal.confirm('确定要退出当前单位吗？退出就无法在打开此单位。', function(jg){
				if(jg=='yes')c.editcompanys();
			});
		},
		editcompanys:function(){
			js.ajax.get({
				url:'api/company/exit',
				cnum:this.cnum,
				loading:'退出中...',
				loadsuccess:'退出成功',
				onsuccess:function(){
					js.reload();
				}
			});
		},
		gotoim:function(){
			var d 	= this.info;
			xcy.opencompany({
				num:this.cnum,
				name:d.companyname,
				hmode:1
			}, true);
		},
		gotplat:function(){
			xcy.openkey({url:'home'});
		},
		changecompany:function(){
			addtabs({name:'切换单位','url':'reim/company',num:'tcompany',params:{cnum:this.cnum,ismobile:0,hmode:'0'}});
		}
	}
	
	js.initbtn(c);
});
</script>
<div align="center">

	<div align="center" style="padding:10px 0px;margin-top:10px"><img style="width:80px;height:80px;border-radius:50%" onclick="js.viewimg(this)" id="myface_geren" src="images/noface.png" align="absmiddle"></div>
	
	<div style="display:inline-block" align="center" valign="top">
	
	<div style="min-width:250px;display:none;margin-right:15px;float:left"  id="dwdiv{rand}" align="left">
		<div style="padding:15px 5px 2px 10px;" class="hui fontsize12">单位里信息</div>
		<div class="rock-panel rock-border rock-radius rock-list-group">
			<div class="rock-list-item rock-hover">
				姓名
				<font class="hui"><span style="font-size:14px" id="dwname{rand}"></span></font>
			</div>
			<div class="rock-list-item rock-hover" clickevt="changecompany">
				当前单位
				<font class="hui"><span style="font-size:14px" id="companyname{rand}"></span>&nbsp;<i class="icon-angle-right"></i></font>
			</div>
			<div class="rock-list-item">
				部门
				<font class="hui"><span style="font-size:14px" id="deptname{rand}"></span></font>
			</div>
			<div class="rock-list-item">
				职位
				<font class="hui"><span style="font-size:14px" id="ranking{rand}"></span></font>
			</div>
			<div class="rock-list-item">
				手机号
				<font class="hui"><span style="font-size:14px" show="mobile" id="shouji{rand}"></span></font>
			</div>
			<div class="rock-list-item">
				单位用户级别
				<font class="hui"><span style="font-size:14px" id="unitjibie{rand}"></span></font>
			</div>
			<div class="rock-list-item rock-hover" id="gotoim{rand}" clickevt="gotoim">
				进入IM模式
				<font class="hui"><i class="icon-angle-right"></i></font>
			</div>
			<div class="rock-list-item rock-hover" clickevt="editcompany">
				退出当前单位
				<font class="hui"><i class="icon-angle-right"></i></font>
			</div>
		</div>
	</div>
	
	
	<div style="min-width:250px;float:left" align="left">
		<div style="padding:15px 5px 2px 10px;" class="hui fontsize12">平台里信息</div>
		<div class="rock-panel rock-border rock-radius rock-list-group">
			<div class="rock-list-item rock-hover">
				姓名
				<font class="hui"><span style="font-size:14px" id="name{rand}"></span>&nbsp;<i class="icon-angle-right"></i></font>
			</div>
			<div class="rock-list-item">
				平台用户级别
				<font class="hui"><span style="font-size:14px" id="jibie{rand}"></span></font>
			</div>
			<div class="rock-list-item rock-hover" clickevt="editmobile">
				手机号
				<font class="hui"><span show="mobile" style="font-size:14px" id="mobile{rand}"></span>&nbsp;<i class="icon-angle-right"></i></font>
			</div>
			<div class="rock-list-item rock-hover" clickevt="editface">
				修改头像
				<font class="hui"><i class="icon-angle-right"></i></font>
			</div>
			<div class="rock-list-item rock-hover" clickevt="editpassv">
				修改密码
				<font class="hui"><i class="icon-angle-right"></i></font>
			</div>
			<div class="rock-list-item rock-hover" clickevt="gotplat">
				进入平台主页
				<font class="hui"><i class="icon-angle-right"></i></font>
			</div>
		</div>
	
	</div>
	</div>
	

	
	<div style="margin-top:30px"><input clickevt="loginexit" style="width:150px" type="button" value="退出系统" class="webbtn webbtn-big bg-outline-danger rock-border rock-hover"></div>
	
</div>